package com.elaticsearch.test;

import com.sun.org.slf4j.internal.Logger;
import com.sun.org.slf4j.internal.LoggerFactory;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;

/**
 * @author:左泽林
 * @date:日期:2021-08-27-时间:20:46
 * @message:
 */

public class ESTest_Client {
    private static final Logger logger = LoggerFactory.getLogger(ESTest_Client.class);
    public static void main(String[] args) {

        //创建ES客户端
        RestHighLevelClient esClient = new RestHighLevelClient(
                RestClient.builder(new HttpHost("172.20.17.43",9200,"http"))
        );

        //关闭ES客户端
        try {
            esClient.close();
        }catch (Exception e){
            System.out.println(e);
        }
    }
}
